
#ifndef PLAYSCENE_H
#define PLAYSCENE_H


#include <QMainWindow>
#include<QGraphicsScene>
#include"character.h"
#include<QKeyEvent>
#include"rubbish.h"
#include<QMouseEvent>
#include"enemy.h"
#include<vector>
#include<QPaintEvent>
#include"failedscene.h"
#include<QMediaPlayer>
#include"successscene.h"
#include<QLabel>

class PlayScene : public QMainWindow
{
    Q_OBJECT
public:
    explicit PlayScene(QWidget *parent = nullptr);
    QGraphicsScene* scene;
    Character* lumine;
    FailedScene* failedscene;
    SuccessScene* successscene;

    QTimer* moveTimer;
    QTimer* moveActTimer;
    QTimer* jumpTimer;
    QTimer* addmc;
    QTimer* addpvz;
    QTimer* add77;

    std::vector<Rubbish*>rubbishArr;
    std::vector<Enemy*>EnemyArr;

    QMediaPlayer* playmusic;

    void keyPressEvent(QKeyEvent *event);
    void keyReleaseEvent(QKeyEvent *event);
    int dx=0;
    int dy;
    bool jumpflag=0;

    void isMeet(Character* lumine,Rubbish* rubbishx);
    void jump();
    void fall();

    void mousePressEvent(QMouseEvent* event);
    void mouseReleaseEvent(QMouseEvent* event);

    void isAttacked(Character* lumine,Enemy* enemyx);
    void isMeetEnemy(Enemy* enemy,Rubbish* rubbishx);

    void getLabel(Rubbish* rubbish);

signals:
    void speedup();
    void jumpup();
    void success();

};

#endif // PLAYSCENE_H
